<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
    <head th:fragment="adminHead(title)">
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
        <meta name="description" content="">
        <meta name="author" content="">
        <title th:text="${title}"></title>
        <link th:href="@{/asserts/css/bootstrap.min.css}" href="../../static/asserts/css/bootstrap.min.css" rel="stylesheet">
        <link th:href="@{/asserts/css/dashboard.css}" href="../../static/asserts/css/dashboard.css" rel="stylesheet">
        <!-- 图标 -->
        <link rel="stylesheet" href="https://cdn.bootcdn.net/ajax/libs/font-awesome/5.13.0/css/all.css">
        <link rel="stylesheet" th:href="@{/css/common.css}" href="../../static/css/common.css">
        <style type="text/css">
            @-webkit-keyframes chartjs-render-animation {
                from {
                    opacity: 0.99
                }
                to {
                    opacity: 1
                }
            }

            @keyframes chartjs-render-animation {
                from {
                    opacity: 0.99
                }
                to {
                    opacity: 1
                }
            }
        </style>
    </head>
    <body>
        <!-- 顶部 -->
        <nav th:fragment="navHead" class="navbar navbar-dark sticky-top bg-dark flex-md-nowrap p-0">
            <a class="navbar-brand col-sm-3 col-md-2 mr-0" href="http://getbootstrap.com/docs/4.0/examples/dashboard/#">
                西安旅游电子票务后台
            </a>
            <ul class="navbar-nav px-3">
                <li class="nav-item text-nowrap">
                    <a class="nav-link d-inline-block" href="javascript:void(0);" onclick="logout()">退出</a>
                </li>
            </ul>
        </nav>

        <!-- 导航 -->
        <nav th:fragment="navbar(active)" class="col-md-2 d-none d-md-block bg-light sidebar">
            <div class="sidebar-sticky">
                <ul class="nav flex-column">
                    <li class="nav-item">
                        <a class="nav-link" th:classappend="${active == 1} ? 'active' : ''" th:href="@{/admin}"
                           href="#">
                            <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"
                                 fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"
                                 stroke-linejoin="round" class="feather feather-database">
                                <ellipse cx="12" cy="5" rx="9" ry="3"></ellipse>
                                <path d="M21 12c0 1.66-4 3-9 3s-9-1.34-9-3"></path>
                                <path d="M3 5v14c0 1.66 4 3 9 3s9-1.34 9-3V5"></path>
                            </svg>
                            仪表盘
                        </a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" th:classappend="${active == 2} ? 'active' : ''" th:href="@{/admin/sites}"
                           href="#">
                            <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"
                                 fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"
                                 stroke-linejoin="round" class="feather feather-file">
                                <path d="M13 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9z"></path>
                                <polyline points="13 2 13 9 20 9"></polyline>
                            </svg>
                            景点管理
                        </a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" th:classappend="${active == 3} ? 'active' : ''" th:href="@{/admin/users}"
                           href="#">
                            <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"
                                 fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"
                                 stroke-linejoin="round" class="feather feather-users">
                                <path d="M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"></path>
                                <circle cx="9" cy="7" r="4"></circle>
                                <path d="M23 21v-2a4 4 0 0 0-3-3.87"></path>
                                <path d="M16 3.13a4 4 0 0 1 0 7.75"></path>
                            </svg>
                            用户管理
                        </a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" th:classappend="${active == 4} ? 'active' : ''" th:href="@{/admin/orders}"
                           href="#">
                            <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"
                                 fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"
                                 stroke-linejoin="round" class="feather feather-shopping-cart">
                                <circle cx="9" cy="21" r="1"></circle>
                                <circle cx="20" cy="21" r="1"></circle>
                                <path d="M1 1h4l2.68 13.39a2 2 0 0 0 2 1.61h9.72a2 2 0 0 0 2-1.61L23 6H6"></path>
                            </svg>
                            订单管理
                        </a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" th:classappend="${active == 5} ? 'active' : ''" th:href="@{/admin/api}"
                           href="#">
                            <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"
                                 fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"
                                 stroke-linejoin="round" class="feather feather-file">
                                <path d="M13 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9z"></path>
                                <polyline points="13 2 13 9 20 9"></polyline>
                            </svg>
                            接口文档
                        </a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" th:classappend="${active == 6} ? 'active' : ''" th:href="@{/admin/db}"
                           href="#">
                            <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"
                                 fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"
                                 stroke-linejoin="round" class="feather feather-database">
                                <ellipse cx="12" cy="5" rx="9" ry="3"></ellipse>
                                <path d="M21 12c0 1.66-4 3-9 3s-9-1.34-9-3"></path>
                                <path d="M3 5v14c0 1.66 4 3 9 3s9-1.34 9-3V5"></path>
                            </svg>
                            数据监控
                        </a>
                    </li>
                </ul>
            </div>
        </nav>

        <!-- 通用 js -->
        <th:block th:fragment="commonJs">
            <script src='https://cdn.jsdelivr.net/npm/jquery@3.4.1/dist/jquery.min.js'></script>
            <script type="text/javascript" th:src="@{/asserts/js/popper.min.js}"
                    src="../../static/asserts/js/popper.min.js"></script>
            <script type="text/javascript" th:src="@{/asserts/js/bootstrap.min.js}"
                    src="../../static/asserts/js/bootstrap.min.js"></script>
            <script type="text/javascript" th:src="@{/asserts/js/feather.min.js}"
                    src="../../static/asserts/js/feather.min.js"></script>
            <script th:src="@{/js/bootstrapQ.js}" src='../../static/js/bootstrapQ.js'></script>
            <script>
                feather.replace()
            </script>
            <script th:inline="javascript">
                // 退出登录
                function logout() {
                    $.post(/*[[@{/admin/logout.do}]]*/'', (response) => {
                        location.href = /*[[@{/admin/login}]]*/'';
                    });
                }
            </script>
        </th:block>
    </body>
</html>